#pragma once

#include <vector>

#include <DirectXMath.h>
#include <d3d11.h>

#include "IComponent.h"
#include "IRenderable.h"
#include "IEffect.h"

class Mesh : public virtual IComponent, IRenderable
{
public:
	Mesh(void);
	~Mesh(void);

	virtual void Initialize(HWND WindowHandle = nullptr, HINSTANCE hInstance = nullptr, ID3D11Device* Device = nullptr, ID3D11DeviceContext* DeviceContext = nullptr);
	virtual void Update(int DeltaTime);
	virtual void Shutdown();
	virtual void Render();
	
	ID3D11Buffer* GetCB();

	void SetVertexBuffer(ID3D11Buffer* VertexBuffer);
	void SetConstantBuffer(ID3D11Buffer* ConstantBuffer);
	void SetMaterialIndex(int MaterialIndex);
	void SetStride(int Stride);
	void SetNumVertices(int Vertices);
	void SetInputLayout(ID3D11InputLayout* InputLayout);
	void SetShaders(ID3D11VertexShader* VertexShader, ID3D11PixelShader* PixelShader);
	void SetWorldMatrix(XMFLOAT4X4 WorldMatrix);
	void UpdateCB(XMFLOAT4X4 ViewMatrix, XMFLOAT4X4 ProjectionMatrix);

private:
	ID3D11Device* D3DDevice;
	ID3D11DeviceContext* D3DDeviceContext;

	ID3D11Buffer* mVertexBuffer;
	ID3D11Buffer* mConstantBuffer;
	ID3D11InputLayout* mInputLayout;
	ID3D11VertexShader* mVertexShader;
	ID3D11PixelShader* mPixelShader;

	XMMATRIX mWorldMatrix;

	unsigned int mMaterialIndex;
	unsigned int mStride;
	unsigned int mNumVertices;
};

